home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / Form / Sources / ScrollEd.cpp < prev    next >
Encoding:
Text File  |  1996-12-16  |  18.7 KB  |  617 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ScrollEd.cpp
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "Form.hpp"
  11.  
  12. #ifndef SCROLLED_H
  13. #include "ScrollEd.h"
  14. #endif
  15.  
  16. #ifndef FRAME_H
  17. #include "Frame.h"
  18. #endif
  19.  
  20. #ifndef EDITCMD_H
  21. #include "EditCmd.h"
  22. #endif
  23.  
  24. #ifndef FWPART_H
  25. #include "FWPart.h"
  26. #endif
  27.  
  28. #ifndef FWEVENT_H
  29. #include "FWEvent.h"
  30. #endif
  31.  
  32. #ifndef FWEVEDEF_H
  33. #include "FWEveDef.h"
  34. #endif
  35.  
  36. #ifndef FWSCLBAR_H
  37. #include "FWSclBar.h"
  38. #endif
  39.  
  40. #ifndef FWSCLNOT_H
  41. #include "FWSclNot.h"
  42. #endif
  43.  
  44. #ifndef FWCONTXT_H
  45. #include "FWContxt.h"
  46. #endif
  47.  
  48. #ifndef FWCONTXT_H
  49. #include "FWContxt.h"
  50. #endif
  51.  
  52. #ifndef FWARDYNA_H
  53. #include "FWArDyna.h"
  54. #endif
  55.  
  56. #ifndef FWMNUBAR_H
  57. #include "FWMnubar.h"
  58. #endif
  59.  
  60. // ----- PPob View Support -----
  61.  
  62. #if FW_PPOB_VIEWS
  63. #include "FWPPobRd.h"
  64. #endif
  65.  
  66. #ifndef SOM_Module_OpenDoc_Commands_defined
  67. #include "CmdDefs.xh"
  68. #endif
  69.  
  70. //========================================================================================
  71. // RunTime Info
  72. //========================================================================================
  73.  
  74. #ifdef FW_BUILD_MAC
  75. #pragma segment odfform
  76. #endif
  77.  
  78. FW_DEFINE_CLASS_M3(CScrollEdit, FW_CEditView, FW_MReceiver, FW_MNotifier);
  79. FW_DEFINE_AUTO(CScrollEdit)
  80.  
  81. const FW_ClassTypeConstant LScrollEd = FW_TYPE_CONSTANT('S','e','d','v');
  82. FW_REGISTER_ARCHIVABLE_CLASS(LScrollEd, CScrollEdit, CScrollEdit::Create, FW_CView::Read, CScrollEdit::Destroy, FW_CView::Write)
  83.  
  84. //========================================================================================
  85. // CScrollEdit
  86. //========================================================================================
  87.  
  88. // Documentation
  89. // -------------
  90. // CScrollEdit adds scrolling functionalities to FW_CEditView and adds support for
  91. // Undo/Redo clipboard commands
  92. //
  93. // CScrollEdit inherits from FW_MReceiver in order to respond to scrolling notifications
  94. //
  95. // CScrollEdit must disable its clipboard commands when the
  96. // view is deleted (see discussion in CEditViewCommand::HandleNotification)
  97. //
  98. // A CScrollEdit object requires a vertical and/or an horizontal scrollbars.  
  99. // It can be created from resources, see the type RScrollEdit in Form's views.fr
  100.  
  101. //----------------------------------------------------------------------------------------
  102. // CScrollEdit::CScrollEdit
  103. //----------------------------------------------------------------------------------------
  104.  
  105. CScrollEdit::CScrollEdit (Environment* ev, 
  106.                         FW_CSuperView* container, 
  107.                         const FW_CRect& bounds,
  108.                         ODID viewID, 
  109.                         FW_CScrollBar* horzSB,
  110.                         FW_CScrollBar* vertSB,
  111.                         const FW_CString& str, 
  112.                         const FW_CFont& font,
  113.                         short maxChars, 
  114.                         unsigned short attributes,
  115.                         FW_Fixed textWidth) 
  116.     : FW_CEditView(ev, container, bounds, viewID, str, font, maxChars, attributes),
  117.     FW_MReceiver()
  118. {
  119.     fScrollbars[FW_kHorizontal] = horzSB;
  120.     fScrollbars[FW_kVertical] = vertSB;
  121.     
  122.     // use the view width by default
  123.     fWidth = (textWidth == FW_kFixed0) ? bounds.Size().x : textWidth;
  124.             
  125.     Initialize(ev);
  126. }
  127.  
  128. //----------------------------------------------------------------------------------------
  129. // CScrollEdit::CScrollEdit
  130. //----------------------------------------------------------------------------------------
  131. CScrollEdit::CScrollEdit(Environment* ev)
  132.     : FW_CEditView(ev),
  133.     FW_MReceiver()
  134. {
  135. }
  136.  
  137. //----------------------------------------------------------------------------------------
  138. // CScrollEdit::Initialize
  139. //----------------------------------------------------------------------------------------
  140.  
  141. void CScrollEdit::Initialize(Environment* ev)
  142. {
  143.     // scrolling view responds to scrollbar notifications
  144.     if (fScrollbars[FW_kVertical]) 
  145.         AddInterest(FW_CInterest(fScrollbars[FW_kVertical], FW_kScrollMsg));
  146.  
  147.     if (fScrollbars[FW_kHorizontal]) 
  148.         AddInterest(FW_CInterest(fScrollbars[FW_kHorizontal], FW_kScrollMsg));
  149.  
  150.     AdjustTERects(ev);
  151.     UpdateScrollParameters(ev);
  152.     UpdateScrollUnits(ev);
  153. }
  154.  
  155. //----------------------------------------------------------------------------------------
  156. // CScrollEdit::~CScrollEdit
  157. //----------------------------------------------------------------------------------------
  158.  
  159. CScrollEdit::~CScrollEdit ()
  160. {
  161.     // Don't delete the scroll bars, we don't own them! 
  162.     
  163.     if (fScrollbars[FW_kHorizontal])
  164.     {
  165.         FW_CInterest interest(fScrollbars[FW_kHorizontal], FW_kScrollMsg);
  166.         RemoveInterest(interest);
  167.     }
  168.     if (fScrollbars[FW_kVertical])
  169.     {
  170.         FW_CInterest interest(fScrollbars[FW_kVertical], FW_kScrollMsg);
  171.         RemoveInterest(interest);
  172.     }
  173. }
  174.  
  175. //----------------------------------------------------------------------------------------
  176. // CScrollEdit::AdjustTERects
  177. //----------------------------------------------------------------------------------------
  178.  
  179. void CScrollEdit::AdjustTERects(Environment* ev)
  180. {
  181.     TEHandle teHdl = (TEHandle)GetPlatformEditHandle(ev);
  182.     TEPtr te = *teHdl;
  183.     
  184.     // Set viewRect height to a multiple of lines to avoid cutting lines
  185.     te->viewRect.bottom = (((te->viewRect.bottom - te->viewRect.top) / te->lineHeight)
  186.                             * te->lineHeight) + te->viewRect.top;
  187.  
  188.     // Adjust width of destination rectangle for text scrolling horizontally
  189.     if (fScrollbars[FW_kHorizontal])
  190.         te->destRect.right = te->destRect.left + FW_FixedToInt(fWidth);
  191. }
  192.  
  193. //----------------------------------------------------------------------------------------
  194. // CScrollEdit::SizeChanged
  195. //----------------------------------------------------------------------------------------
  196.  
  197. void CScrollEdit::SizeChanged (Environment* ev, const FW_CPoint& oldSize)
  198. {
  199.     // call base class to update the TEd viewRect
  200.     FW_CEditView::SizeChanged(ev, oldSize);
  201.     
  202.     AdjustTERects(ev);
  203.     
  204.     // We use the fact that the scrollbars have already been resized because they
  205.     // were created before the CScrollEdit object.
  206.     UpdateScrollParameters(ev);
  207.     UpdateScrollUnits(ev);    
  208. }
  209.  
  210. //----------------------------------------------------------------------------------------
  211. // CScrollEdit::UpdateScrollUnits
  212. //----------------------------------------------------------------------------------------
  213.  
  214. void CScrollEdit::UpdateScrollUnits(Environment* ev)
  215. {
  216.     TEHandle teHdl = (TEHandle)GetPlatformEditHandle(ev);
  217.     FW_CScrollBar* sb = fScrollbars[FW_kHorizontal];
  218.  
  219.     if (sb)
  220.     {
  221.         short major = (**teHdl).viewRect.right - (**teHdl).viewRect.left;
  222.         short minor = major / 10;
  223.         sb->SetMinorScrollUnits(ev, FW_IntToFixed(minor));
  224.         sb->SetMajorScrollUnits(ev, FW_IntToFixed(major));    
  225.     }
  226.  
  227.     sb = fScrollbars[FW_kVertical];
  228.     if (sb)
  229.     {
  230.         short major = ((**teHdl).viewRect.bottom - (**teHdl).viewRect.top) / (**teHdl).lineHeight;
  231.         sb->SetMajorScrollUnits(ev, FW_IntToFixed(major));    
  232.         // minor scroll unit is always 1 line.
  233.     }
  234. }
  235.  
  236. //----------------------------------------------------------------------------------------
  237. // CScrollEdit::UpdateScrollParameters
  238. //----------------------------------------------------------------------------------------
  239. void CScrollEdit::UpdateScrollParameters(Environment* ev)
  240. {
  241.     AdjustScrollbar(ev, FW_kVertical);
  242.     AdjustScrollbar(ev, FW_kHorizontal);
  243.     
  244.     // Must also scroll the Ted to match up the new scrollbar values
  245.     // in case a scroll bar became inactive and the Ted was already scrolled
  246.     AdjustTE(ev);
  247. }
  248.  
  249. //----------------------------------------------------------------------------------------
  250. // CScrollEdit::AdjustTE
  251. //----------------------------------------------------------------------------------------
  252. void CScrollEdit::AdjustTE(Environment* ev)
  253. {
  254.     // We must create a graphic context and adjust the Mac text-edit
  255.     // before making any native TE calls
  256.     FW_CViewContext gc (ev, this, GetFrame(ev)->GetActiveFacet(ev));
  257.     MacAdjustRects (ev, gc);
  258.     
  259.     TEHandle teHdl = (TEHandle)GetPlatformEditHandle(ev);
  260.     
  261.     FW_CScrollBar* sb = fScrollbars[FW_kHorizontal];
  262.     short hScroll = 0;
  263.     if (sb)
  264.         hScroll = ((**teHdl).viewRect.left - (**teHdl).destRect.left) - FW_FixedToInt(sb->GetScrollPos(ev));
  265.  
  266.     sb = fScrollbars[FW_kVertical];
  267.     short vScroll = 0;
  268.     if (sb)
  269.         vScroll = ((**teHdl).viewRect.top - (**teHdl).destRect.top) - 
  270.                     (FW_FixedToInt(sb->GetScrollPos(ev)) * ((**teHdl).lineHeight));
  271.         
  272.     TEScroll(hScroll, vScroll, teHdl);
  273. }
  274.  
  275. //----------------------------------------------------------------------------------------
  276. // CScrollEdit::AdjustScrollbar
  277. //----------------------------------------------------------------------------------------
  278. // Code borrowed from the MPW example TEDocument.cp
  279.  
  280. void CScrollEdit::AdjustScrollbar(Environment* ev, FW_XYSelector direction)
  281. {
  282.     FW_CScrollBar* sb = fScrollbars[direction];
  283.     if (sb == NULL)
  284.         return;
  285.  
  286.     TEHandle teHdl = (TEHandle)GetPlatformEditHandle(ev);
  287.     TEPtr     te = *teHdl;
  288.     int max = 0;
  289.     int oldMax = FW_FixedToInt(sb->GetScrollMax(ev));
  290.     
  291.     if (direction == FW_kVertical)
  292.     {
  293.         short lines = te->nLines;
  294.         // add 1 line if last char is a return
  295.         if ( *(*te->hText + te->teLength - 1) == 13 )
  296.             lines += 1;
  297.         max = lines - (( te->viewRect.bottom - te->viewRect.top ) / te->lineHeight);
  298.     }
  299.     else
  300.     {
  301.         max = FW_FixedToInt(fWidth) - ( te->viewRect.right - te->viewRect.left );    
  302.     }
  303.  
  304.     if (max < 0) max = 0;
  305.     
  306.     // Must convert to fixed number for SetScrollMax
  307.     sb->SetScrollMax(ev, FW_IntToFixed(max));
  308.  
  309.     te = *teHdl;
  310.     int value;
  311.     int oldValue = FW_FixedToInt(sb->GetScrollPos(ev));
  312.     
  313.     if (direction == FW_kVertical)
  314.         value = ( te->viewRect.top - te->destRect.top ) / te->lineHeight;
  315.     else 
  316.         value = te->viewRect.left - te->destRect.left;
  317.     
  318.     if (value < 0)
  319.         value = 0;
  320.     else if (value > max)
  321.         value = max;
  322.     
  323.     // Must convert to fixed number for SetScrollPos
  324.     sb->SetScrollPos(ev, FW_IntToFixed(value));
  325.     
  326.     if (value == oldValue && max != oldMax)
  327.         sb->RedrawControl(ev);
  328. }
  329.  
  330. //----------------------------------------------------------------------------------------
  331. // CScrollEdit::DoAdjustMenus
  332. //----------------------------------------------------------------------------------------
  333.  
  334. FW_Handled CScrollEdit::DoAdjustMenus (Environment *ev, FW_CMenuBar* menuBar, 
  335.                         FW_Boolean hasMenuFocus, FW_Boolean isRoot)
  336. {
  337.     // Let base class adjust the Edit menu first
  338.     FW_CEditView::DoAdjustMenus(ev, menuBar, hasMenuFocus, isRoot);
  339.  
  340.     if (hasMenuFocus)
  341.     {
  342.         // update the Paste command
  343.         FW_Boolean hasClipboard = GetFrame(ev)->HasSupportedKindOnClipboard(ev);
  344.         menuBar->EnableCommand (ev, kODCommandPaste, hasClipboard);
  345.     }
  346.     return FW_kNotHandled;    // let parent views adjust their menus
  347. }
  348.  
  349. //----------------------------------------------------------------------------------------
  350. // CScrollEdit::DoMenu
  351. //----------------------------------------------------------------------------------------
  352.  
  353. FW_Handled CScrollEdit::DoMenu (Environment* ev, const FW_CMenuEvent& event)
  354. {
  355.     ODCommandID id = event.GetCommandID(ev);
  356.     FW_Handled commandHandled = FW_kHandled;
  357.     
  358.     switch (id) 
  359.     {
  360.         case kODCommandCut: 
  361.         case kODCommandCopy: 
  362.         case kODCommandPaste: 
  363.         case kODCommandClear: 
  364.             // Ask the frame to create an EditView command:
  365.             // if the command is created, execute it
  366.             // if the frame didn't implement NewClipboardCommand(), revert to default behavior
  367.             CEditViewCommand* cmd = (CEditViewCommand*)GetFrame(ev)->NewClipboardCommand(ev, id);
  368.             if (cmd)
  369.             {
  370.                 cmd->SetEditView(this);
  371.                 if (cmd->GetSelection(ev) == NULL)
  372.                 {
  373.                     // The presentation doesn't have any selection, we create one on the fly
  374.                     cmd->SetSelection(FW_NEW(CEditViewSelection, (ev, this)));
  375.                 }
  376.                 cmd->Execute(ev);                
  377.             }
  378.             else
  379.             {
  380.                 DoTECommand(ev, id, true);    // Will use normal scrap
  381.             }
  382.             UpdateScrollParameters(ev);
  383.             break;
  384.  
  385.         default:
  386.             commandHandled = FW_CEditView::DoMenu (ev, event); // call base class
  387.  
  388.             if (id == kODCommandSelectAll) 
  389.                 UpdateScrollParameters(ev);
  390.     }
  391.     return commandHandled;
  392. }
  393.  
  394. //----------------------------------------------------------------------------------------
  395. // CScrollEdit::HandleNotification
  396. //----------------------------------------------------------------------------------------
  397.  
  398. void CScrollEdit::HandleNotification(Environment* ev, const FW_CNotification& notification)
  399. {
  400.     if (notification.GetMessage() == FW_kScrollMsg)
  401.     {
  402.         const FW_CScrollNotification& scrollNfy = (FW_CScrollNotification&) notification;
  403.     
  404.         FW_XYSelector direction = scrollNfy.GetDirection(ev);
  405.         int amount = FW_FixedToInt(-scrollNfy.GetDelta(ev));
  406.         
  407.         if (amount != 0)
  408.         {
  409.             TEHandle teHdl = (TEHandle)GetPlatformEditHandle(ev);
  410.             
  411.             // We must create a graphic context and adjust the Mac text-edit
  412.             // before making any native TE calls
  413.             FW_CViewContext gc (ev, this, GetFrame(ev)->GetActiveFacet(ev));
  414.             MacAdjustRects (ev, gc);
  415.             
  416.             if (direction == FW_kVertical)
  417.                 TEScroll(0, amount * (*teHdl)->lineHeight, teHdl);
  418.             else
  419.                 TEScroll(amount, 0, teHdl);
  420.         }
  421.     }
  422. }
  423.  
  424. //----------------------------------------------------------------------------------------
  425. // CScrollEdit::DoVirtualKeyDown
  426. //----------------------------------------------------------------------------------------
  427.  
  428. FW_Handled CScrollEdit::DoVirtualKeyDown (Environment* ev, const FW_CVirtualKeyEvent & event)
  429. {
  430.     // Let base class handle the key first
  431.     FW_Handled keyHandled = FW_CEditView::DoVirtualKeyDown(ev, event);
  432.  
  433.     short    keyCode = event.GetKeyCode(ev);
  434.     
  435.     // Handle PageUp and PageDown keys
  436.     if (keyHandled == false && (keyCode == FW_kVKPageUp || keyCode == FW_kVKPageDown))
  437.     {
  438.         TEHandle teHdl = (TEHandle)GetPlatformEditHandle(ev);
  439.         short amount = ((**teHdl).viewRect.bottom - (**teHdl).viewRect.top);
  440.         if (keyCode == FW_kVKPageDown)
  441.             amount = - amount;
  442.             
  443.         FW_CViewContext gc (ev, this, GetFrame(ev)->GetActiveFacet(ev));
  444.         MacAdjustRects (ev, gc);
  445.  
  446.         TEScroll(0, amount, teHdl);
  447.  
  448.         keyHandled = FW_kHandled;
  449.         UpdateScrollParameters(ev);
  450.     }
  451.     
  452.     return keyHandled;
  453. }
  454.  
  455. //----------------------------------------------------------------------------------------
  456. // CScrollEdit::DoCharKeyDown
  457. //----------------------------------------------------------------------------------------
  458.  
  459. FW_Handled CScrollEdit::DoCharKeyDown (Environment* ev, const FW_CCharKeyEvent& event)
  460. {
  461.     // Let base class handle the character first
  462.     FW_Handled handled = FW_CEditView::DoCharKeyDown(ev, event);
  463.     
  464.     // Update scrollbars
  465.     if (handled) 
  466.         UpdateScrollParameters(ev);
  467.     
  468.     return handled;
  469. }
  470.  
  471. //----------------------------------------------------------------------------------------
  472. // CScrollEdit::DoMouseDown
  473. //----------------------------------------------------------------------------------------
  474.  
  475. FW_Handled CScrollEdit::DoMouseDown (Environment* ev, const FW_CMouseEvent& event)
  476. {
  477.     FW_Handled handled = FW_CEditView::DoMouseDown(ev, event);
  478.     
  479.     // Adjust the scrollbars here after auto-scrolling may have occured 
  480.     UpdateScrollParameters(ev);
  481.     
  482.     return handled;
  483. }
  484.  
  485. //----------------------------------------------------------------------------------------
  486. //    CScrollEdit::SetText
  487. //----------------------------------------------------------------------------------------
  488.  
  489. void CScrollEdit::SetText (Environment * ev, const FW_CString& str)
  490. {
  491.     FW_CEditView::SetText(ev, str);
  492.     UpdateScrollParameters(ev);
  493. }
  494.  
  495. //========================================================================================
  496. //    Archiving API with ODFRC resources
  497. //========================================================================================
  498. #if FW_ODFRC_VIEWS
  499.  
  500. //----------------------------------------------------------------------------------------
  501. //    CScrollEdit::Create
  502. //----------------------------------------------------------------------------------------
  503.  
  504. void* CScrollEdit::Create(FW_CReadableStream& stream, FW_ClassTypeConstant type)
  505. {
  506. FW_UNUSED(stream);
  507. FW_UNUSED(type);
  508.     FW_SOMEnvironment ev;
  509.     return FW_NEW(CScrollEdit, (ev));
  510. }
  511.  
  512. //----------------------------------------------------------------------------------------
  513. //    CScrollEdit::Destroy
  514. //----------------------------------------------------------------------------------------
  515.  
  516. void CScrollEdit::Destroy(void* object, FW_ClassTypeConstant type)
  517. {
  518. FW_UNUSED(type);
  519.     CScrollEdit* self = (CScrollEdit*) object;
  520.     delete self;
  521. }
  522.  
  523. //----------------------------------------------------------------------------------------
  524. //    CScrollEdit::Flatten
  525. //----------------------------------------------------------------------------------------
  526.  
  527. void CScrollEdit::Flatten(Environment* ev, FW_CWritableStream& stream) const
  528. {
  529.     FW_CEditView::Flatten(ev, stream);
  530.  
  531.     ODID horizScrollBarID = (fScrollbars[FW_kHorizontal] == NULL) ? kODNULLID :
  532.                                 fScrollbars[FW_kHorizontal]->GetViewID(ev);
  533.     ODID vertScrollBarID = (fScrollbars[FW_kVertical] == NULL) ? kODNULLID :
  534.                                 fScrollbars[FW_kVertical]->GetViewID(ev);
  535.  
  536.     stream << horizScrollBarID << vertScrollBarID << fWidth;
  537. }
  538.  
  539. //----------------------------------------------------------------------------------------
  540. //    CScrollEdit::InitializeFromStream
  541. //----------------------------------------------------------------------------------------
  542.  
  543. void CScrollEdit::InitializeFromStream(Environment* ev, FW_CReadableStream& stream)
  544. {
  545.     FW_CEditView::InitializeFromStream(ev, stream);
  546.     
  547.     ODID horizScrollBarID;
  548.     ODID vertScrollBarID;
  549.     stream >> horizScrollBarID >> vertScrollBarID >> fWidth;
  550.  
  551.     FW_CSuperView* parentView = GetSuperView(ev);
  552.     FW_ASSERT(parentView);
  553.     
  554.     FW_CView* hScrollBarView = NULL;
  555.     if (horizScrollBarID != kODNULLID)
  556.         hScrollBarView = parentView->FindViewByID(ev, horizScrollBarID);
  557.  
  558.     FW_CView* vScrollBarView = NULL;
  559.     if (vertScrollBarID != kODNULLID)
  560.         vScrollBarView = parentView->FindViewByID(ev, vertScrollBarID);
  561.  
  562.     fScrollbars[FW_kHorizontal] = FW_DYNAMIC_CAST(FW_CScrollBar, hScrollBarView);
  563.     fScrollbars[FW_kVertical] = FW_DYNAMIC_CAST(FW_CScrollBar, vScrollBarView);
  564.     
  565.     Initialize(ev);
  566. }
  567.  
  568. #endif // FW_ODFRC_VIEWS
  569.  
  570. //========================================================================================
  571. //    API for reading PPob view resources
  572. //========================================================================================
  573. #if FW_PPOB_VIEWS
  574.  
  575. // CPPobScrollEdit is an AutoDestruct class because it derives from one
  576. //FW_DEFINE_AUTO(CPPobScrollEdit)
  577.  
  578. void ReadScrollingEdit (Environment* ev, FW_CPPobReader* context, FW_CReadableStream& stream)
  579. {
  580.     //
  581.     // Handle the base class information (LText)
  582.     //
  583.     
  584.     FW_SPPobTextInfo info (stream);
  585.     
  586.     long hsbID, vsbID;
  587.     stream >> hsbID >> vsbID;
  588.     
  589.     //
  590.     // Now find our scrollbars
  591.     //
  592.     
  593.     FW_CSuperView* parent = context->GetSuperView();
  594.     FW_CScrollBar* horzSB = hsbID ? FW_DYNAMIC_CAST (FW_CScrollBar, parent->FindViewByID (ev, hsbID)) : kODNULL;
  595.     FW_CScrollBar* vertSB = vsbID ? FW_DYNAMIC_CAST (FW_CScrollBar, parent->FindViewByID (ev, vsbID)) : kODNULL;
  596.     FW_ASSERT (("Move scrollers up in the Constructor list", horzSB || vertSB)); // Warning! They must be created already
  597.     
  598.     //
  599.     //
  600.     // Create the CScrollEdit instance
  601.     //
  602.     
  603.     CScrollEdit* view = FW_NEW (CScrollEdit, (ev, context->GetSuperView(), info.fBounds, 
  604.         info.fViewID, horzSB, vertSB, info.fText, info.fTextTraits.fFont));
  605.     view->SetBindings (ev, info.fBindings);
  606.     
  607.     //
  608.     // LTextEdit allows subviews in theory (although it wouldn't work).
  609.     // FW_CEditView doesn't.
  610.     //
  611.     
  612.     context->SetNextSuperView (kODNULL);
  613. }
  614.  
  615. #endif // FW_PPOB_VIEWS
  616.  
  617.